if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tbl_Buddy]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[tbl_Buddy]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tbl_Logon]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[tbl_Logon]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tbl_Schedule]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[tbl_Schedule]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tbl_User]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[tbl_User]
GO

CREATE TABLE [dbo].[tbl_Buddy] (
	[UID] [char] (36) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[BuddyId] [char] (36) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[tbl_Logon] (
	[UID] [char] (36) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[IP] [char] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[StartTime] [datetime] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[tbl_Schedule] (
	[UID] [char] (36) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[ApptId] [char] (36) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[StartDate] [datetime] NOT NULL ,
	[StartTime] [datetime] NOT NULL ,
	[Length] [int] NOT NULL ,
	[Description] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[IsPrivate] [bit] NOT NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[tbl_User] (
	[UID] [char] (36) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[ScreenName] [char] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[PWD] [char] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[FName] [char] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[LName] [char] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[Address1] [char] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[Address2] [char] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[City] [char] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[State] [char] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[Region] [char] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
	[Country] [int] NOT NULL 
) ON [PRIMARY]
GO

